<?php
session_start();
include 'interface.php';
include 'dbconnect.php';
$dbcnx = dbconnect();
$name= $_POST["name"];
$login= $_POST["login"];
$password = $_POST["password"]; 





$query = "INSERT INTO `newsdb`.`users` (`name`, `login`, `password`) 
			VALUES (\"$name\", \"$login\", \"$password\")";
$qres = mysql_query($query); 
echo "<html>";
echo "<title>";
  echo "Чатик - Регистрация";
echo "</title>";
echo "<body>";

    echo "<table width = \"100%\" bordercolor = \"green\"><!-- \"#5a009c\" -->";
        drawHeader();
    echo "<tr>";
        echo "<td></td>";
        echo "<td colspan = \"2\" rowspan = \"2\">";
		
        if ($qres != 0)	
		{
			echo "Регистрация прошла успешно!  ";
			echo "<a href = index.php?type=1> На главную </a>";
		} else {
			echo "Пользователь с таким логином уже существует!";
			//die('Беда=( ' .mysql_error());
		}        
        echo "</td>";
        echo "</tr>";
    echo "</table>";   
echo "</body>";	
echo "</html>";
?>

